<table>
  <tr>
    <td>  <b>Name:</b></td>
    <td> <%=h @product.name %></td>
    <td><b>Serial:</b></td>
    <td><%=h @product.serial %> </td>
    <td> <b>Sort:</b>      </td>
    <td>  <%=h @product.sort.try(:name) %> </td>
  </tr>
  <tr>
    <td>   <b>Color:</b></td>
    <td>  <%=h @product.color.try(:name) %></td>
    <td> <b>Price:</b></td>
    <td> <%=h @product.price %> </td>
    <td>  <b>Current price:</b>   </td>
    <td>   <%=h @product.current_price %></td>
  </tr>
  <tr>
    <td>    <b>State:</b></td>
    <td><%=h Product::STATE[ @product.state] %> </td>

    <td>  <b>Rank:</b></td>
    <td> <%=h Product::RANK[@product.rank] %></td>
    <td>  <b>Hits:</b>  </td>
    <td>   <%=h @product.hits %></td>
  </tr>
  <tr>
    <td>  <b>Introduction:</b></td>
    <td> <%=h @product.introduction %></td>
    <td> </td>
    <td> </td>
    <td> </td>
  </tr>
</table>
添加图片
<% form_for([:admin, @production_image], :html => { :multipart => true}) do |f| %>
  <%= f.error_messages %>
    <%=  f.file_field(:image) %>
  <p>
    <%= f.hidden_field :product_id , :value=>@product.id %>
  </p>
  <p>
    <%= f.submit '上传' %>
  </p>
<% end %>
<%=@product.product_images.size%>
<table>
  <tr>
    <th>顺序</th>
    <th>图片</th>
    <th>图片大小</th>
    <th>排序</th>
    <th>操作</th>

  </tr>

  <%  @product.product_images.each do |i| %>
    <tr>
      <td><%=h i.sort %></td>
      <td><%=image_tag i.image.url ,:size=>"60x60" %></td>
      <td><%=h "#{(i.image_file_size/(1024.0*1024.0)).to_s[0..5]}M(兆)" %></td>
      <td>
        <%= link_to_remote((image_tag "/images/sort_up.jpg" ,:size => "10x15"),:url=>product_image_sort_ajax_path(:product_id=>@product.id ,:product_image_id => i.id,:sort => "up"),:method => :get,:before => "disabled_page('true');",:complete => "disabled_page('false');")%>
        <%= link_to_remote((image_tag "/images/sort_down.jpg",:size => "10x15"),:url=>product_image_sort_ajax_path(:product_id=>@product.id, :product_image_id =>i.id,:sort => "down"),:method => :get,:before => "disabled_page('true');",:complete => "disabled_page('false');") %>
      </td>
      <td><%= link_to 'Destroy', admin_product_image_path(i,:product_id=>@product.id), :confirm => 'Are you sure?', :method => :delete %></td>
    </tr>
  <%end%>
</table>





<%= link_to 'Edit', edit_admin_product_path(@product) %> |
<%= link_to 'Back', admin_products_path %>